//
//  JMBubbleView.m
//  NewiOSProject
//
//  Created by apple on 2023/10/23.
//  Copyright © 2023 范智渊. All rights reserved.
//

#import "JMBubbleView.h"

@implementation JMBubbleView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _valueLba = [JMControl createLabelWithFrame:(CGRectMake(0, 0, frame.size.width, 21)) Font:fontWithWeight(12, UIFontWeightMedium) Text:@"" color:Hex_Str_COLOR(@"#F6FF82")];
        _valueLba.textAlignment = 1;
        _valueLba.cornerRadius = 19/2.0;
        _valueLba.backgroundColor = Hex_Str_COLOR(@"#0F1511");
        self.backgroundColor = UIColor.clearColor;
        [self addSubview:_valueLba];
    }
    return self;
}
//// 覆盖drawRect方法，你可以在此自定义绘画和动画
- (void)drawRect:(CGRect)rect
{
    //An opaque type that represents a Quartz 2D drawing environment.
    //一个不透明类型的Quartz 2D绘画环境,相当于一个画布,你可以在上面任意绘画
    CGContextRef context = UIGraphicsGetCurrentContext();
    /*画三角形*/
//    CGPoint  _arrowOffset = CGPointMake(53/2.0, 27);
    CGPoint sPoints[3];//坐标点
    sPoints[0] = CGPointMake(53/2.0, 27);
    sPoints[1] = CGPointMake(53/2.0-6 , 21);//坐标2
    sPoints[2] = CGPointMake(53/2.0+6 , 21);//坐标2
    CGContextAddLines(context, sPoints, 3);//添加线
    //填充色
    float r = 15 / 255.0;
    float g = 21 / 255.0;
    float b = 17 / 255.0;
    UIColor *aColor = [UIColor colorWithRed:r green:g blue:b alpha:1];
    CGContextSetFillColorWithColor(context, aColor.CGColor);
    //画线笔颜色
    CGContextSetRGBStrokeColor(context,r, g, b,1.0);//画笔线的颜色
    CGContextClosePath(context);//封起来
    CGContextDrawPath(context, kCGPathFillStroke); //根据坐标绘制路径
}
@end
